/*
    This file is part of ciberRatoToolsSrc.

    Copyright (C) 2001-2006 Universidade de Aveiro

    ciberRatoToolsSrc is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    ciberRatoToolsSrc is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

#ifndef _CIBER_RATO_CRQLABVIEW_
#define _CIBER_RATO_CRQLABVIEW_

/*! \class CRQLabView
 *  \brief Class that implements one main window where the application will run.
 */


#include<qmainwindow.h>
#include<qstatusbar.h>
#include<qcanvas.h>
#include"crqcanvas.h"
#include"crmainparameters.h"
#include"Comm/crqcomm.h"
#include"Lab/crlab.h"

class CRQComm;

/*! \class CRQCanvasView
 *  \brief Displays a view of the canvas.
 */

class CRQCanvasView : public QCanvasView
{
public:
	/*! This is the constructor. It only creates a new QCanvasView.
	 */
	CRQCanvasView(CRQCanvas *viewing, QWidget *parent, const char *name,
				 WFlags f );
	/*! This is the destructor.
	 */
	~CRQCanvasView();
};

// *****************************************************************************

class CRQLabView : public QMainWindow
{
Q_OBJECT
public:
	/*! This is the constructor.
	 * One main window will be created with some menus and one empty central area.
	 */
	CRQLabView(CRMainParameters*);

	CRQLabView();
	/*! This is the destructor.
	 */
	~CRQLabView();
	/*! This function will create all tool buttons in the main window.
	 */
	void placeToolButtons( QToolBar* );
	/*! \var statusBar
	 * Status bar to show some information.
	 */
	QStatusBar *statusBar;

	char soundStatus;

private:
	/*! Function that does the necessary to create all the menus.
	 */
	void placeMenus();
	/*! \var canvas
	 * Pointer to the canvas that will contain the lab.
	 */
	CRQCanvas *canvas;
	/*! \var comm Pointer to the communication object.
	 */
	CRQComm *comm;

	QString skinFileName;

	CRMainParameters *param;

	CRLab *lab;

	CRQCanvasView *visualCanvas;

public slots:
	/*! Do one reset on viewer. The backImage is draw again and the score window
	 * is closed.
	 */
	void reset();

	/*! Connect to simulator. At this moment the port is 600 and address is 
	 * the address passed in begining.
	 */
	void connect();

	/*! This function will create one QFileDialog box used to change the skin.
	 */
	void skin();

	/*! This function will create one QFileDialog box used to change play one
	 * music file.
	 */
	void playFile();

	/*! This function will create one message box with the about information.
	 */
	void aboutBox();

	/*! This function will create one color box that allows us to choose the
	 * color of the walls with an height lower than the beacon height.
	 */
	void lColor();

	/*! This function will create one color box that allows us to choose the
	 * color of the walls with an height higher than the beacon height.
	 */ 
	void hColor();

	/*! This function will resize the window, according to the size of the 
	 * canvas plus the box and menu bar size!
	 */
	void changeDim(int, int);

	void sound(void);
	
signals:
	/*! Old signal used to load a new file. Not in use.
	 */
	void loadNewLab( QString );
};

#endif
